// const requireComponent = require.context('@', true, /[\w-]+\.vue$/)

const requireComponent = require.context(
  '@',
  true,
  /^(?!\.\/assets).*[\w-]+\.vue$/
)

//根据相对路径获取 对应的key
const getKey = str => {
  if (str.indexOf('../') === -1) {
    return str
  } else {
    return getKey(str.replace(/\/[\w-]+\/\.\.\//, '/'))
  }
}

export { requireComponent, getKey }
